﻿@model Solution.Business.Entities.News

@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}

<h2>Edit</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm("Edit", "AdminNews", FormMethod.Post, new { enctype = "multipart/form-data" })) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>News</legend>

        @Html.HiddenFor(model => model.NewsId)

        <div class="editor-label">
            @Html.LabelFor(model => model.Title)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Title)
            @Html.ValidationMessageFor(model => model.Title)
             <span style="color:red;">*</span>
        </div>       

        <div class="editor-label">
            @Html.LabelFor(model => model.Content)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.Content, new { @id = "ckeContent" })
            <script type="text/javascript">
                CKEDITOR.replace("ckeContent");
            </script>
             <span style="color:red;">*</span>
        </div>

         <div class="editor-label">
            @Html.Label("Hình ảnh đại diện:")
        </div>
        <div class="editor-field">
            <input type="file" name="file" id="file" />
             <span style="color:red;">*</span>
        </div>

        
        <div class="editor-label">
            @Html.LabelFor(model => model.Price, "Giá :")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Price)
            @Html.ValidationMessageFor(model => model.Price)
             <span style="color:red;">*</span>
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.PmId, "Loại tiền :")
        </div>
        <div class="editor-field">
            @Html.DropDownList("PmId", (SelectList)ViewBag.PmId)
            @Html.ValidationMessageFor(model => model.PmId)
             <span style="color:red;">*</span>
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Acreage, "Diện tích :")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Acreage)
            @Html.ValidationMessageFor(model => model.Acreage)
             <span style="color:red;">*</span>
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.UnId, "Đơn vị tính :")
        </div>
        <div class="editor-field">
            @Html.DropDownList("UnId", (SelectList)ViewBag.UnId)
            @Html.ValidationMessageFor(model => model.UnId)
             <span style="color:red;">*</span>
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Address, "Địa chỉ :")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address)
            @Html.ValidationMessageFor(model => model.Address)
             <span style="color:red;">*</span>
        </div>
 
        <div class="editor-label">
            @Html.LabelFor(model => model.TrId, "Loại hình bất động sản :")
        </div>
        <div class="editor-field">
            @Html.DropDownList("TrId", (SelectList)ViewBag.TrId)
            @Html.ValidationMessageFor(model => model.TrId)
             <span style="color:red;">*</span>
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.LId, "Quận/Huyện :")
        </div>
        
        <div class="editor-field">
            @Html.DropDownList("LId", (SelectList)ViewBag.LId)
            @Html.ValidationMessageFor(model => model.LId)
             <span style="color:red;">*</span>
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.DId, "Hướng bất động sản :")
        </div>
        <div class="editor-field">
            @if(Model.LgId == null)
            {
            @Html.DropDownList("DId", String.Empty)
            }
            else
            {@Html.DropDownList("DId", (SelectList)ViewBag.DId)}
            
            @Html.ValidationMessageFor(model => model.DId)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.LgId, "Tình trạng pháp lý :")
        </div>
        <div class="editor-field">
            @if(Model.LgId == null)
            {
            @Html.DropDownList("LgId", String.Empty);
            }
            else
            {@Html.DropDownList("LgId", (SelectList)ViewBag.LgId);}
            @Html.ValidationMessageFor(model => model.LgId)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Position, "Vị trí tin :")
        </div>
        <div class="editor-filed">
        <select id="Position" name="Position">
	        @if(Model.Position == 1){
		        <option value="0" selected>Vị trí Vip</option>
		        <option value="1">Vị trí bình thường</option>	
         }
         else
         {	
		        <option value="0">Vị trí Vip</option>	
		        <option value="1" selected>Vị trí bình thường</option>
	        }
        </select>
             <span style="color:red;">*</span>
            </div>

        <div class="editor-label">
            @Html.Label("Hình ảnh 1:")
        </div>
        <div class="editor-field">
            <input type="file" name="file1" id="file1" />
        </div>

       <div class="editor-label">
            @Html.Label("Hình ảnh 2:")
        </div>
        <div class="editor-field">
            <input type="file" name="file2" id="file2" />
        </div>

        <div class="editor-label">
            @Html.Label("Hình ảnh 3:")
        </div>
        <div class="editor-field">
            <input type="file" name="file3" id="file3" />
        </div>

        <div class="editor-label">
            @Html.Label("Hình ảnh 4:")
        </div>
        <div class="editor-field">
            <input type="file" name="file4" id="file4" />
        </div>

        <div class="editor-label">
            @Html.Label("Hình ảnh 5:")
        </div>
        <div class="editor-field">
            <input type="file" name="file5" id="file5" />
        </div>

        <div class="editor-label">
            @Html.Label("Hình ảnh 6:")
        </div>
        <div class="editor-field">
            <input type="file" name="file6" id="file6" />
        </div>

        <div class="editor-label">
            @Html.Label("Hình ảnh 7:")
        </div>
        <div class="editor-field">
            <input type="file" name="file7" id="file7" />
        </div>

        <div class="editor-label">
            @Html.Label("Hình ảnh 8:")
        </div>
        <div class="editor-field">
            <input type="file" name="file8" id="file8" />
        </div>

        <div class="editor-label">
            @Html.Label("Hình ảnh 9:")
        </div>
        <div class="editor-field">
            <input type="file" name="file9" id="file9" />
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Video)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.Video, new { @id = "ckeVideo" })
            <script type="text/javascript">
                CKEDITOR.replace("ckeVideo");
            </script>
        </div>
         <div class="editor-label">
            @Html.LabelFor(model => model.Map)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.Map, new { @id = "ckeMap" })
            <script type="text/javascript">
                CKEDITOR.replace("ckeMap");
            </script>
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Status, "Trạng thái hiển thị :")
        </div>
        <div class="editor-field">
        <select id="Status" name="Status">
	        @if (Model.Status == 1)
            {
		        <option value="1" selected>Hiện tin</option>
		        <option value="2">Ẩn tin</option>	
            }
         else
            {	
		        <option value="1">Hiện tin</option>	
		        <option value="2" selected>Ẩn tin</option>
	        }
        </select>
             <span style="color:red;">*</span>
            </div>
       
        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
